
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>地区列表 - Powered By MYMOB.MOBI</title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <% include("../inc/list_css.html"){}%>
    <link href="/res/css/common.css" rel="stylesheet" type="text/css" />
    <script src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script><!--common-->
    <script type="text/javascript" src="/res/js/common.js"></script>
    <script type="text/javascript" src="/res/js/list.js"></script>
    <script type="text/javascript">
        $().ready(function() {

            //增加区域
            $("#add").click(function () {
                var parentId=$("input[name='parentId']").val();
                window.location.href="add?parentId="+parentId;
            });


            $(".delete").click(function () {
                var $this = $(this);
                var id=$this.attr("val");//区域id
                //删除区域
                parent.layer.confirm('您确定要删除吗?删除后可能会影响运费模板和用户收货地址管理,请谨慎操作!', {
                    shade: [0.3,'#fff'],//0.1透明度的白色背景
                    btn: ['是','否'] //按钮
                }, function(){
                    $.ajax({
                        url: "delete",
                        type: 'GET',
                        data:{
                            "id": id
                        },
                        success: function(data){
                            if (data.state == "ok"){
                                layer.msg("操作成功");
                                $this.parent().remove()
                            }else{
                                layer.msg(data.info);
                            }
                            parent.layer.closeAll();
                        }
                    });
                });


            });
        });




    </script>
</head>
<body>
<div class="ibox ">
    <div class="ibox-title">
        <div class="pull-left mbx navbar_title">
            <span>系统设置 </span>
            <span class="line">/</span>
            地区管理
        </div>
    </div>
    <div class="ibox-content">
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-md-12">
                    <div class="alert alert-warning alert-dismissable">
                        <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                        删除后可能会影响运费模板和用户收货地址管理,请谨慎操作。<br>
                    </div>
                    <div class="btn-group margin-vertical-4_0">
                        <button class="hive-btn-md-large hive-btn-primary" id="add">
                            <i class="icon-add" aria-hidden="true"></i>&nbsp;添加
                        </button>
                    </div>
                    <input type="hidden" name="parentId" value="${parent.id!}"/>
                    <table id="listTable" class="list margin-top-12">
                        <tr>
                            <th colspan="5" class="green" style="text-align: center;">
                                <%if(isEmpty(parent)){%>
                                    顶级地区
                                <%}else{%>
                                    上级地区-${parent.name!}
                                <%}%>
                            </th>
                        </tr>
                        <%
                        var amount=areaSystemList.~size;
                        var count=0;
                        if(areaSystemList.~size%5==0){
                            count=parseInt(areaSystemList.~size/5);
                        }else{
                            count=parseInt(areaSystemList.~size/5+1);
                        }
                        %>
                        <%for(var i=0;count>i;i++){%>
                        <tr>
                            <td>
                               <%if(amount>(i*5+0)){%>
                                <a href="list?parentId=${areaSystemList[i*5+0].id!}" title="查看">${areaSystemList[i*5+0].name!}</a>
                                <a href="edit?id=${areaSystemList[i*5+0].id!}">[编辑]</a>
                                <a href="javascript:;" class="delete" val="${areaSystemList[i*5+0].id!}">[删除]</a>
                               <%}%>
                            </td>
                            <td>
                                <%if(amount>(i*5+1)){%>
                                <a href="list?parentId=${areaSystemList[i*5+1].id!}" title="查看">${areaSystemList[i*5+1].name}</a>
                                <a href="edit?id=${areaSystemList[i*5+1].id!}">[编辑]</a>
                                <a href="javascript:;" class="delete" val="${areaSystemList[i*5+1].id!}">[删除]</a>
                                <%}%>
                            </td>
                            <td>
                                <%if(amount>(i*5+2)){%>
                                <a href="list?parentId=${areaSystemList[i*5+2].id!}" title="查看">${areaSystemList[i*5+2].name!}</a>
                                <a href="edit?id=${areaSystemList[i*5+2].id!}">[编辑]</a>
                                <a href="javascript:;" class="delete" val="${areaSystemList[i*5+2].id!}">[删除]</a>
                                <%}%>
                            </td>
                            <td>
                                <%if(amount>(i*5+3)){%>
                                <a href="list?parentId=${areaSystemList[i*5+3].id!}" title="查看">${areaSystemList[i*5+3].name!}</a>
                                <a href="edit?id=${areaSystemList[i*5+3].id!}">[编辑]</a>
                                <a href="javascript:;" class="delete" val="${areaSystemList[i*5+3].id!}">[删除]</a>
                                <%}%>
                            </td>
                            <td>
                                <%if(amount>(i*5+4)){%>
                                <a href="list?parentId=${areaSystemList[i*5+4].id!}" title="查看">${areaSystemList[i*5+4].name!}</a>
                                <a href="edit?id=${areaSystemList[i*5+4].id!}">[编辑]</a>
                                <a href="javascript:;" class="delete" val="${areaSystemList[i*5+4].id!}">[删除]</a>
                                <%}%>
                            </td>
                        </tr>
                        <%}%>
                    </table>
                </div>

            </div>

        </div>

    </div>
</div>
<% include("../inc/list_js.html"){}%>
</body>
</html>